home *** CD-ROM | disk | FTP | other *** search
- Path: news.hklink.net!usenet
- From: alex@station.net (Alex Chu)
- Newsgroups: comp.lang.c
- Subject: malloc question
- Date: Sun, 10 Mar 1996 05:26:29 GMT
- Organization: HongKongLink (Tel: 23882399 Fax: 23882188 Net: info@hklink.net)
- Message-ID: <4htonk$350@news.hklink.net>
- NNTP-Posting-Host: ttyl3.station.net
- X-Newsreader: Forte Free Agent 1.0.82
-
-
- Hi everybody,
-
- I have a question for the following snip C program.
-
- typedef struct item {
- int val;
- struct item *next;
- } ITEM, *PITEM;
-
- main()
- {
- PITEM head, current;
- head=(PITEM) malloc(sizeof(ITEM));
- ^^^^^^^
- head->val=1;
- }
-
- I want to know why need to use the type casting PITEM in front of the
- malloc ? Please help!
-
-
- Alex Chu
-
-
-
-